<template>
  <!-- <div :class="['nav-item', curIndex === index ? 'selected' : '']" 
  @click="changeCurIndex(index)">
    {{ item | replaceNumChs }}
  </div> -->
  <div class="nav-item" 
  :style="{backgroundColor: curIndex === index ? bgc : ''}"
  @click="changeCurIndex(index)"
  >
    {{ item }}
  </div>
</template>

<script>
export default {
  name: 'NavItem',
  props: {
    item: {
      type: String,
    },
    index: Number,
    curIndex: Number,
    bgc: {
      type: String,
      default: 'orange',
    }
  },
  methods: {
    changeCurIndex(index) {
      this.$emit('changeTabIndex', index)
    }
  },
};
</script>

<style lang="less">
.nav-item.selected {
  color: #fff;
}
</style>
